//record part of object


import java.io.*;


public class Main{
	public static void main(String[] args){
		Member[] members={	new Member("JJ",90),
					new Member("kk",80),
					new Member("GG",70),};


		try{
			//write---------------------------------
			DataOutputStream dataoutputstream=new DataOutputStream(new FileOutputStream(args[0]));

			for(Member member:members){
				dataoutputstream.writeUTF(member.getName());
				dataoutputstream.writeInt(member.getAge());
			}
			dataoutputstream.flush();
			dataoutputstream.close();


			//---------------------------------
			DataInputStream datainputstream=new DataInputStream(new FileInputStream(args[0]));

			for(int i=0;i<members.length;i++){
				String name=datainputstream.readUTF();
				int score=datainputstream.readInt();
				members[i]=new Member(name,score);
			}	
			datainputstream.close();
			for(Member member:members){
				System.out.printf("%s=%d%n",member.getName(),member.getAge());
			}
			System.out.println("copy finish");

		}
		catch(IOException e){
			e.printStackTrace();
		}
	}
}